/**
 * 
 */
package com.coldworks.base.util;

import java.io.File;
import java.util.regex.Pattern;

import android.net.Uri;

/**
 * 常量集
 * 
 * @since 2012-03-23
 */
public final class BaseCONST {
	private BaseCONST() {
	}

	public static class COM {
		public static final String NAME = "ColdWorks";
	}

	public static class API {
		public static Uri URI_PREFERAPN = Uri
				.parse("content://telephony/carriers/preferapn");
		public static final String LIVEWALLPAPER_SIGN = "android.service.wallpaper.WallpaperService"; // 动态壁纸的特征
		public static final String PACKAGE_PARSER = "android.content.pm.PackageParser";
		public static final String ASSET_MANAGER = "android.content.res.AssetManager";
		public static final String INSTALL_CMD = "application/vnd.android.package-archive"; // 安装软件uri
	}

	public static class NETWORK {
		public static final String DISABLED = "DISABLED"; // 网络不可用
		public static final String WIFI = "WIFI"; // wifi网络
		public static final String MOBILE = "MOBILE"; // 电信,移动,联通,等mobile网络
		public static final String CMWAP = "CMWAP"; // 移动wap
		public static final String UNIWAP = "UNIWAP"; // 联通wap
		public static final String CTWAP = "CTWAP"; // 电信wap
		public static final String OTHER = "OTHER"; // 其它未知网络
	}

	public static class URL {
		public static final String LOCAL_HOST = "file:///android_asset";
		public static final String HELP = LOCAL_HOST + "/help.html"; // 帮助
		public static final String ERROR = LOCAL_HOST + "/error.html"; // 加載失敗頁面
		public static final String BLANK = "about:blank"; // 空白页
	}

	public static class HTTP {
		public static final Pattern CMD_PATTERN = Pattern
				.compile("#t\\d+(:[\\w|.]+(,[\\w|.]+)*)?(?=#|$)");
		public static final String CMD_SPLIT = ":|,";
		public static final int BUFFER_SIZE = 8192;
		public static final int CONNECT_TIMEOUT = 10000;
		public static final int SO_TIMEOUT = 15000;
		public static final String COOKIE_KEY = "cookie=";
	}

	public static class LOGGER {
		public static final String TAG = COM.NAME;
		public static final long LOG_MAX_LENGTH = 1024 * 1024 * 1;
	}

	public static class TASK {
		public static final int SPLASH_SECOND = 4;
		public static final int LOAD_SLOW_SECOND = 10;
		public static final int SHORTCUT_SETUP_SECOND = 1;
		public static final int CONF_REPORT_SECOND = 2;
		public static final int CLEAR_DIRS_SECOND = 3;
		public static final int LOG_REPORT_SECOND = 4;
		public static final int SPLASH_SYNC_SECOND = 5;
		public static final int ONEKEY_ONLINE_INIT_SECOND = 6;
	}

	public static class BITMAP {
		public static final int MAX_BITMAP_PIXELS = 0x400000; // 最大位图加载像素（width*height），超过该阀值可能导致OOM异常
	}

	public static class SPLASH {
		public static final String SPLASH_REGEX_FULL = "^splash\\d{4}-\\d{2}-\\d{2}-v\\d+.jpg$";
		public static final String SPLASH_REGEX_V = "-v\\d+(?=.jpg)";
		public static final Pattern SPLASH_PATTERN_V = Pattern
				.compile("\\d+(?=.jpg)");
	}

	public static class KEY {
		public static final String LOG_REPORTING = "LOG_REPORTING"; // 是否要发送log
		public static final String LOG_REPORTED = "LOG_REPORTED"; // 是否要发送log
		public static final String NIGHT_MODE = "NIGHT_MODE"; // 用于记录是否夜间模式
		public static final String SETUP_SHORTCUT = "SETUP_SHORTCUT"; // 用于记录是否生成过桌面图标
		public static final String FOLDER_CLEARED = "FOLDER_CLEARED"; // 用于判断是否清理过文件夹
		public static final String DISABLE_DIAGNOSIS = "DISABLE_DIAGNOSIS"; // 用于记录是否发送诊断报告
		public static final String VERSION_CODE = "VERSION_CODE"; // 记录版本号
		public static final String SHOW_GUIDE = "SHOW_GUIDE"; // 用于记录是否展示过新功能引导页
		public static final String LAST_NOTIFY_TIME = "LAST_NOTIFY_TIME";

		// 本地用户信息
		public static final String USER_NAME = "USER_NAME"; // 本地用户名字
		public static final String USER_EMAIL = "USER_EMAIL"; // 本地用户Email
		public static final String USER_ID = "USER_ID"; // 本地用户ID
		public static final String USER_PASSWORD = "USER_PASSWORD"; // 本地用户密码
		public static final String USER_ICON = "USER_ICON";// 本地用户头像地址
		public static final String USER_REMEMBER_PWD = "USER_REMEMBER_PWD";// 本地用户是否记录密码
		public static final String USER_SEESION_ID = "USER_SEESION_ID";
		public static final String IS_AUTO_LOGIN = "IS_AUTO_LOGIN"; // 用于记录是否自动登录
	}

	public static class SHORTCUT {
		public static final String ACTION_ADD_SHORTCUT = "com.android.launcher.action.INSTALL_SHORTCUT"; // 用于产生桌面图标
		public static final String ACTION_DEL_SHORTCUT = "com.android.launcher.action.UNINSTALL_SHORTCUT"; // 用于产生桌面图标
		public static final String SHORTCUT_DUPLICATE = "duplicate";
	}

	public static class DIR {
		// 一级目录
		public static final String ROOT = File.separator + COM.NAME;
		// 二级目录
		public static final String BACKUP = ROOT + File.separator + "backup";
		public static final String DATA = ROOT + File.separator + ".data";
		public static final String SAVE = ROOT + File.separator + "save";
		// 三级目录
		public static final String SPLASH = DATA + File.separator + "splash";
		public static final String CACHE = DATA + File.separator + "cache";
		public static final String TEMP = DATA + File.separator + "temp";
		public static final String ICON = DATA + File.separator + "icon";
		public static final String IMG = DATA + File.separator + "image";
		public static final String TOPIC = DATA + File.separator + "topic";
	}

	public static class FILE {
		// 三级目录下的文件
		public static final String LOG = DIR.TEMP + File.separator
				+ "coldjoke.log";
		public static final String LOG_ERR = DIR.TEMP + File.separator
				+ "coldjoke.err";
		public static final int BUFFER_SIZE = 1024 * 4;
		public static final String JPG_EXTENSION = ".jpg";
		public static final String APK_EXTENSION = ".apk";
		public static final String TEMP_EXTENSION = ".tmp"; // 保存的临时文件名后缀
		public static final String SHARE = DIR.TEMP + File.separator
				+ "share.jpg"; // 分享的图片
	}

	public static class OP {
		public static final int ERR_OME = 0x100;
		public static final int ERR_NOSD = 0x101;
		public static final int ERR_NET = 0x102;
		public static final int ERR_IO = 0x103;
		public static final int ERR_SYS = 0x104;
		public static final int ERR_OUT_OF_STORE = 0x105;

		public static final int FAIL = 0x110;
		public static final int SUCC = 0x111;
		public static final int CANCEL = 0x112;
		public static final int BACK = 0x113;

		public static final int HELP = 0x114;
		public static final int LOGOUT = 0x115;
		public static final int SLOW = 0x116;
		public static final int ALERT = 0x117;
		public static final int NAVIGATION = 0x118;
		public static final int SPLASH_GONE = 0x119;
		public static final int GUIDE_DONE = 0x120;

		public static final int BACK_HOME = 0x130;
		public static final int HIDE_NAV = 0x131;
		public static final int POP_NAV = 0x132;
		public static final int NAVIGATE = 0x133;

		public static final int NO_UPDATE = 0x134;
		public static final int REQUIRE_UPDATE = 0x135;
		public static final int REQUIRE_UPDATE_FORCE = 0x138;
		public static final int NO_JOKES = 0x136;
		public static final int COMMENT_REPEAT = 0x137;

		public static final int EVENT_GET_PRE_ARTICLE_FINISH = 0x143;
		public static final int EVENT_GET_PRE_COMIC_FINISH = 0x144;
		public static final int EVENT_GET_PRE_ALL_FINISH = 0x145;

		public static final int EVENT_GET_JUDGE_JOKE_SUCC = 0x146;
		public static final int EVENT_GET_JUDGE_JOKE_FAIL = 0x147;
		public static final int EVENT_GET_JUDGE_JOKE_NO_MORE = 0x148;

		public static final int EVENT_INPUT_IN = 0x149;
		public static final int EVENT_INPUT_OUT = 0x150;
		public static final int EVENT_INPUT_DONE = 0x151;
	}

	public static class NOTIFICATION {
		public static final int UPDATE_NOTIFY_ID = 0x160;
		public static final int DOWNLOAD_NOTIFY_ID = 0x161;
		public static final int PUSH_NOTIFY_ID = 0x162;
		public static final long UPDATE_INTERVAL_DAY = 1; // 提示更新的间隔天
	}

}
